﻿<%@ WebHandler Language="C#" Class="vote" %>

using System;
using System.Web;
using System.Data.OleDb;
using System.Data;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Web.Security;
using System.Text;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;

public class vote : IHttpHandler
{
    
    public void ProcessRequest (HttpContext context) {

        //指定接收数据的类型(解包)
        context.Response.ContentType = "application/json";
        //接收数据(存入变量)
        string webid = context.Request["webid"];


        int result = delData(webid);
        int result1 = delVoteData(webid);

        context.Response.Write(result+result1);
    }

    public int delData(string webid)
    {

        try
        {
            string delSql = String.Format("DELETE FROM web WHERE id={0}", webid);
            return DBHelper.sqlMethodNoDataset(delSql);
        }
        catch (Exception e)
        {
            return 0;
        }
    }
    public int delVoteData(string webid)
    {

        try
        {
            string delSql1 = String.Format("DELETE FROM voteList WHERE webid.id={0}", webid);
            return DBHelper.sqlMethodNoDataset(delSql1);
        }
        catch (Exception e)
        {
            return 0;
        }
    }
    
    
    public bool IsReusable {
        get {
            return false;
        }
    }

}